﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

namespace Forums.UserControls
{
    public partial class SearchFunction : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnGo_Click(object sender, EventArgs e)
        {
            //TODO Validation of Search Field to be completed
            if (txtSearch.Text != string.Empty)
            {
                lblSearchValidator.Visible = false;
                Response.Redirect("SearchResultsPage.aspx?find=" + txtSearch.Text);
            }
            else
            {
                lblSearchValidator.Text = "You must enter a word";
                lblSearchValidator.Visible = true;
            }

            
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {
            lblSearchValidator.Visible = false;
            txtSearch.Text = string.Empty;
            
        }
    }

    
}

